//
// IReader.hh for caziac in /home/renaud_j//work/zia-2013s-barrau_a/api/Http
// 
// Made by johannick renaud
// Login   <renaud_j@epitech.net>
// 
// Started on  Sat Sep  3 17:09:32 2011 johannick renaud
//

#ifndef			CAZIAC_IREADER_HH
# define		CAZIAC_IREADER_HH

/**
 *	\file		IReader.hh
 *	\date		Sat Sep  3 2011
 *	\author		RENAUD J.
 *	\version	2.0
 */

#include		<string>
#include		<vector>

namespace		Caziac
{

  namespace		Tools
  {

    class		IReader
    {

    public:

      virtual			~IReader(){}

      /**
       *	\fn		operator >  (std::string &)
       *	\param		str string to fill
       *	\brief		Get a word from the Reader
       *	\warning	If the reader is empty the string will not be changed
       *	\return		the reader modified
       *
       *	This is an example of a Reader uses :
       *
       *	\code
       *	std::string	first, second;
       *
       *	IReader		*reader = new Reader("A simple example");
       *	
       *	*reader > first > second;
       *	std::cout << first << std::endl; // print "A"
       *	std::cout << second << std::endl; // print "simple"
       *	\endcode
       *
       *	Another example
       *	
       *	\code
       *	std::string	first, second, third;
       *
       *	IReader		*reader = new Reader("TIC \r\nTAC \r\n TOE");
       *	
       *	*reader > first > second > third;
       *	std::cout << first << std::endl;  // print "TIC"
       *	std::cout << second << std::endl; // print ""
       *	std::cout << third << std::endl;  // print "TAC"
       *	\endcode
       *
       *	the second should be empty cause there is no another word
       *	in the line.
       */

      virtual	IReader &	operator >  (std::string &str) = 0;

      /**
       *	\fn		operator >>  (std::string &)
       *	\param		str string to fill
       *	\brief		Get a line from the Reader
       *	\warning	If the reader is empty the string will not be changed
       *	\return		the reader modified
       *
       *	This is an example of a Reader uses :
       *
       *	\code
       *	std::string	first, second, third;
       *
       *	IReader		*reader = new Reader("A simple example\n with multiple lines");
       *	
       *	*reader >> first >> second >> third;
       *	std::cout << first << std::endl;  // print "A simple example"
       *	std::cout << second << std::endl; // print "with multiple lines"
       *	std::cout << third << std::endl; // print ""
       *
       *
       *	*reader >> first;
       *	std::cout << first << std::endl;  // print "A simple example"
       *	\endcode
       *
       */

      virtual IReader &		operator >> (std::string &str) = 0;

      /**
       *	\return		the first word of the reader
       *	\brief		Serve to know if there is a word
       *
       *	This method does not change the buffer
       */

      virtual std::string	getFirstWord() const = 0;

      /**
       *	\return		the first line of the reader
       *	\brief		Serve to know if there is a line
       *
       *	This method does not change the buffer
       */

      virtual std::string 	getFirstLine() const = 0;

      /**
       *	\param		str string to fill
       *	\param		size to read
       *	\brief		read a content length
       *
       *	Read 
       */

      virtual void		readSize(std::vector<char>& buffer,
					 unsigned int const size) = 0;

    };

  }

}

#endif
